package com.steven.concurrent.join;

public class Sleeper extends Thread {
	private int duration;
	public Sleeper(String name, int sleepTime) {
		super(name);
		duration = sleepTime;
		start();
	}
	@Override
	public void run() {
		try {
			sleep(duration);
		} catch (InterruptedException e) {
			// 异常被捕获时被中断标志已经清除了
			System.out.println(getName() + " was interrupted. " + " isInterrupted(): " + isInterrupted());
			return;
		}
		System.out.println(getName() + " has awakended");	// 当Sleeper线程结束, Joiner也将结束
	}
}
